package com.accp.biz.impl;

import java.util.List;
import com.accp.biz.VacationBiz;
import com.accp.dao.VacationDao;
import com.accp.pojo.Vacation;

public class VacationBizImpl implements VacationBiz {
	
	private VacationDao vacationDao;
	
	public void setVacationDao(VacationDao vacationDao) {
		this.vacationDao = vacationDao;
	}
	/**
	 * 申请休假（增加休假信息）
	 */
	@Override
	public boolean add(Vacation vacation) {
		return vacationDao.add(vacation);
	}
	/**
	 * 经理查看休假信息
	 */
	@Override
	public List<Vacation> findByManage(String checker,String name) {
		List<Vacation> list = vacationDao.findByManage(checker, name);
		return list;
	}
	/**
	 * 员工查看休假信息
	 */
	@Override
	public List<Vacation> findByEmployee(String name) {
		List<Vacation> list = vacationDao.findByEmployee(name);
		return list;
	}
	/**
	 * 通过ID查看休假信息
	 */
	@Override
	public Vacation findById(Integer id) {
		return vacationDao.findById(id);
	}
	/**
	 * 审核休假信息
	 */
	@Override
	public boolean updateaudit(Vacation vacation) {
		return vacationDao.updateaudit(vacation);
	}
	/**
	 * //查找（审核人）经理
	 */
	@Override
	public List<String> findManage() {
		List<String> list = vacationDao.findManage();
		return list;
	}
	/**
	 * 删除休假信息
	 */
	@Override
	public boolean delete(Vacation vacation) {
		return vacationDao.delete(vacation);
	}
	
	/**
	 * 分页查询
	 */
	@SuppressWarnings("rawtypes")
	@Override
	public List selectByPage(String className, int pageNo, int pageSize,String checker,String name) {
		List list = vacationDao.selectByPage(className, pageNo, pageSize,checker,name);
		return list;
	}
	/**
	 * 查看下一页
	 */
	@Override
	public int searchRecordsNextPage(int pageSize, String className,String checker,String name) {
		int total = vacationDao.totalPage(className,checker,name);
		int pageNo = total / pageSize;
		if(total % pageSize > 0){
			pageNo++;
		}
		return pageNo;
	}
	
	
}
